/*
 Copyright (c) 2010, Advanced Micro Devices
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without modification, are permitted 
 provided that the following conditions are met:
 
 Redistributions of source code must retain the above copyright notice, this list of conditions 
 and the following disclaimer.
 
 Redistributions in binary form must reproduce the above copyright notice, this list of 
 conditions and the following disclaimer in the documentation and/or other materials provided 
 with the distribution.
 
 Neither the name of Advanced Micro Devices nor the names of its contributors may be used to endorse 
 or promote products derived from this software without specific prior written permission.
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 
 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef __BUFFER_H__
#define __BUFFER_H__


#include "Node.h"
#include "link.h"

class Buffer : public Node
{
    Q_DECLARE_TR_FUNCTIONS( Buffer )

public:
	Buffer( EditorView *, EditorWindow * );
	~Buffer();
	
#if 0
	virtual QPainterPath shape() const;
    virtual QRectF outlineRect() const;
#endif

	void formatText();
	virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);	
	virtual void propertiesDialog();
	virtual void writeXml( QXmlStreamWriter & ) const;
	virtual void readXml( QXmlStreamReader & );
	void build( std::ofstream & );
	virtual QString typeOf(){ return "Buffer"; }

	QString dataType() const
	{
		return mDataType;
	}
	void dataTypeIs( QString dataType )
	{
		mDataType = dataType;
	}

	QString storageClass() const
	{
		return mStorageClass;
	}
	void storageClassIs( QString storageClass )
	{
		mStorageClass = storageClass;
	}

	QString sizeExpression() const
	{
		return mSizeExpression;
	}
	void sizeExpressionIs( QString sizeExpression )
	{
		mSizeExpression = sizeExpression;
	}

	Qt::CheckState CL_MEM_READ_WRITE() const
	{
		return mCL_MEM_READ_WRITE;
	}
	void CL_MEM_READ_WRITEIs( Qt::CheckState CL_MEM_READ_WRITE )
	{
		mCL_MEM_READ_WRITE = CL_MEM_READ_WRITE;
	}
	Qt::CheckState CL_MEM_WRITE_ONLY() const
	{
		return mCL_MEM_WRITE_ONLY;
	}
	void CL_MEM_WRITE_ONLYIs( Qt::CheckState CL_MEM_WRITE_ONLY )
	{
		mCL_MEM_WRITE_ONLY = CL_MEM_WRITE_ONLY;
	}
	Qt::CheckState CL_MEM_READ_ONLY() const
	{
		return mCL_MEM_READ_ONLY;
	}
	void CL_MEM_READ_ONLYIs( Qt::CheckState CL_MEM_READ_ONLY )
	{
		mCL_MEM_READ_ONLY = CL_MEM_READ_ONLY;
	}
	Qt::CheckState CL_MEM_USE_HOST_PTR() const
	{
		return mCL_MEM_USE_HOST_PTR;
	}
	void CL_MEM_USE_HOST_PTRIs( Qt::CheckState CL_MEM_USE_HOST_PTR )
	{
		mCL_MEM_USE_HOST_PTR = CL_MEM_USE_HOST_PTR;
	}
	Qt::CheckState CL_MEM_ALLOC_HOST_PTR() const
	{
		return mCL_MEM_ALLOC_HOST_PTR;
	}
	void CL_MEM_ALLOC_HOST_PTRIs( Qt::CheckState CL_MEM_ALLOC_HOST_PTR )
	{
		mCL_MEM_ALLOC_HOST_PTR = CL_MEM_ALLOC_HOST_PTR;
	}
	Qt::CheckState CL_MEM_COPY_HOST_PTR() const
	{
		return mCL_MEM_COPY_HOST_PTR;
	}
	void CL_MEM_COPY_HOST_PTRIs( Qt::CheckState CL_MEM_COPY_HOST_PTR )
	{
		mCL_MEM_COPY_HOST_PTR = CL_MEM_COPY_HOST_PTR;
	}
	Qt::CheckState dxInterop() const
	{
		return mDxInterop;
	}
	void dxInteropIs( Qt::CheckState dxInterop )
	{
		mDxInterop = dxInterop;
	}
	Qt::CheckState glInterop() const
	{
		return mGlInterop;
	}
	void glInteropIs( Qt::CheckState glInterop )
	{
		mGlInterop = glInterop;
	}

private:
	QString mDataType;
	QString mStorageClass;
	QString mSizeExpression;
	Qt::CheckState mCL_MEM_READ_WRITE;
	Qt::CheckState mCL_MEM_WRITE_ONLY;
	Qt::CheckState mCL_MEM_READ_ONLY;
	Qt::CheckState mCL_MEM_USE_HOST_PTR;
	Qt::CheckState mCL_MEM_ALLOC_HOST_PTR;
	Qt::CheckState mCL_MEM_COPY_HOST_PTR;
	Qt::CheckState mDxInterop;
	Qt::CheckState mGlInterop;

};
typedef QMap<QString, Buffer *> Buffers;

#endif
